<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学籍管理系统</title>
    <script>
        // 页面加载时执行
        window.onload = function() {
            const user = JSON.parse(localStorage.getItem('currentUser'));
            if (user && user.role) {
                if (user.role === 'admin') {
                    window.location.href = 'admin.html';
                } else if (user.role === 'student') {
                    window.location.href = 'student.html';
                } else {
                    // 未知角色或角色信息损坏，跳转到登录页
                    window.location.href = 'login.html';
                }
            } else {
                // 未登录，跳转到登录页
                window.location.href = 'login.html';
            }
        };
    </script>
</head>
<body>
    <p>正在加载，请稍候...</p>
</body>
</html> 